package com.alennus.blog.rabbitMq.spring_rabbit.products_customers;

import com.alennus.blog.rabbitMq.spring_rabbit.config.RabbitConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by pactera on 2018/9/25.
 */
@Component
public class ProductSend2 {


    @Autowired
    public RabbitTemplate rabbitTemplate;


    public void send(String msg){
        String sendMsg = msg + new Date();
        System.out.println("Sender2 : " + sendMsg);

        rabbitTemplate.convertAndSend(RabbitConfig.QUEUE_SIMPLE_HELLO_NAME,msg);
    }
}
